package com.yipingnai.blog.service;

import com.yipingnai.blog.mapper.PVMapper;
import com.yipingnai.blog.model.PV;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PutMapping;

import java.util.Date;
import java.util.List;

/**
 * @Author: 一瓶奶
 * @Url: www.yipingnai.cn
 * @Date: 2020/6/21 13:59
 */
@Service
public class PVService {
    @Autowired
    PVMapper pvMapper;

    // 获取最近7天的访问量
    public List<PV> getPageViewSeven(){
        return pvMapper.getPageViewSeven();
    }

    // 本月访问量总数
    public Integer getPageViewMonth(){
        return pvMapper.getPageViewMonth();
    }

    // 本周访问量总数
    public Integer getPageViewWeek(){
        return pvMapper.getPageViewWeek();
    }

    // 获取总访问量
    public Integer getAllPageView(){
        return pvMapper.getAllPageView();
    }

    public Integer addPv(PV pv){
        return pvMapper.addPv(pv);
    }

    public PV getPvByDate(Date date){
        return pvMapper.getPvByDate(date);
    }

    public Integer updatePvPageViewById(Integer id,Integer pageView){
        return pvMapper.updatePvPageViewById(id,pageView);
    }

}
